﻿using Biotech.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace project.B12.Model.Models
{
    /// <summary>
    /// Instrument.ini配置文件格式
    /// </summary>
    public class InstrumentConf
    {
        public string MotorConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "conf", "Instrument.ini");

        private int areaX;
        public int AreaX
        {
            get { return areaX; }
            set
            {
                areaX = value;
                iniUtil.INIWrite("motor", "areaX", value.ToString(), MotorConfigPath);
            }
        }
        
        private int areaY;
        public int AreaY
        {
            get { return areaY; }
            set
            {
                areaY = value;
                iniUtil.INIWrite("motor", "areaY", value.ToString(), MotorConfigPath);
            }
        }

        public int offsetX { get; set; }
        public int offsetY { get; set; }
        public int stopX { get; set; }
        public int stopY { get; set; }


        private ushort power;
        public ushort Power
        {
            get { return power; }
            set
            {
                power = value;
                iniUtil.INIWrite("led", "power", value.ToString(), MotorConfigPath);
            }
        }
        
        public ushort moveDelay { get; set; }
        public ushort lighDelay { get; set; }

        private int exposure;
        public int Exposure
        {
            get { return exposure; }
            set
            {
                exposure = value;
                iniUtil.INIWrite("camera", "exposure", value.ToString(), MotorConfigPath);
            }
        }
        
        public ushort key { get; set; }
    }
}
